<!DOCTYPE html>
<!--[if lt IE 7]>      <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>         <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>         <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="myApp" class="no-js"> <!--<![endif]-->
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>中华爱情网</title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="shortcut icon" href="favicon.ico" />

  <link rel="stylesheet" href="./bower_components/lumx/dist/lumx.css">
    <link rel="stylesheet" href="./css/app.css">

</head>
<body  style="position:relative;">
<div ng-controller="appCtrl" flex-container="row"  class="bgc-grey-50"  style="background:url('css/bg-login.png') left bottom no-repeat #fff !important;height:100%">
    <div flex-item="12" class="tc-white-2 ">
      <div class="toolbar bgc-blue-grey-800 tc-white-1" style="height:48px;padding-top:4px;padding-bottom:4px;">
        <span class="toolbar__label fs-title">中华爱情网--优惠券</span>
      </div>
      <div class="p++ card tc-black-1" flex-container="row" flex-gutter="24" style="position:absolute;top:40%;right:25%;">
          <div flex-item="12">
              <form>
                  <lx-text-field label="用户名：" fixed-label="true" icon="account">
                      <input type="text" ng-model="userName">
                  </lx-text-field>

                  <lx-text-field label="密码:" fixed-label="true" icon="lock">
                      <input type="password" ng-model="passWord">
                  </lx-text-field>
                  
                  <button style="float:right;" class="btn btn--m btn--blue btn--raised" id="login" ng-click="login()" lx-ripple>登录</button>                    
                  
              </form>
          </div>
      </div>
    </div>
</div>


<script src="./bower_components/jquery/dist/jquery.min.js"></script>
<script src="./bower_components/velocity/velocity.min.js"></script>
<script src="./bower_components/moment/min/moment-with-locales.min.js"></script>
<script src="./bower_components/angular/angular.min.js"></script>
<script src="./bower_components/lumx/dist/lumx.min.js"></script>


<script src="./app.js"></script>
  <script type="text/javascript">
    var myApp = angular.module('myApp',['lumx']);
    
    myApp.controller('appCtrl',['$scope','$http',function($scope,$http) { 
      function kset(key,value) {window.localStorage.setItem( key , value );}
      function kget( key ) { return window.localStorage.getItem( key );}

      $scope.userName = kget('name');
      $scope.login = function(){
        var login_data = {
          'userName' : $scope.userName,
          'passWord' :$scope.passWord
        };

        $http.post('user/login', login_data).success(function(data){
          if(!data.error ){
            kset("name",login_data.userName);
              window.location.href = '/';             
          }else{
                alert(data.message);
          }
        });
      }
      $('body').show();
    }]); 
  </script>
</body>
</html>

